// 请求接口
import request from "@/utils/request.js";

// 查询用户评论的子评论
export function getUserSubComments(userId) {
  return request({
    url: "/comment/sub/" + userId,
    method: "get",
  });
}

// 查询某用户所有评论
export function getUserComments(userId) {
  return request({
    url: "/comment/" + userId,
    method: "get",
  });
}

export function getByArticleId(userId, articleId) {
  return request({
    url: "/comment/" + userId + "/" + articleId,
    method: "get",
  });
}

export function addComment(data) {
  return request({
    url: "/comment",
    method: "post",
    data: data,
  });
}

export function changeCommentDetail(data) {
  return request({
    url: "/comment",
    method: "put",
    data: data,
  });
}

export function addCommentLike(data) {
  return request({
    url: "/comment/addNum",
    method: "put",
    data: data,
  });
}

export function subCommentLike(data) {
  return request({
    url: "/comment/subNum",
    method: "put",
    data: data,
  });
}

export function deleteComment(id, articleId) {
  return request({
    url: "/comment/" + id + "/" + articleId,
    method: "delete",
  });
}
